package com.ihr360.oneclick.dto;

import com.ihr360.commons.model.entity.StringIdWithTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;

@Entity
@Table(name = "tab_term", indexes = {@Index(name = "tab_term_slug_idx", columnList = "slug", unique = true), @Index(name = "tab_term_name_idx", columnList = "termName")})
public class OneClickTermDto extends StringIdWithTime {

    /**
     * 公司Id
     * 默认Id system-default-company-id，应用到所有公司，并且数据不可编辑
     */
    @Column(length = 40, nullable = false)
    private String companyId;

    /**
     * 名称
     */
    @Column(length = 150, nullable = false)
    private String termName;
    /**
     * 别名
     */
    @Column(length = 150)
    private String slug;

    /**
     * 微信菜单名称
     */
    @Column(length = 150)
    private String wechatMenuName;

    @Column(length = 40, columnDefinition = "varchar(40) default '0'")
    private String termGroup;

    @Column(length = 11)
    private int termOrder;

    /**
     * 启用
     */
    @Column
    private Boolean enable;

    /**
     * 功能描述
     */
    @Column(length = 500)
    private String functionDesc;

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "termId")
    private List<OneClickTermMetaDto> termMetaList;

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getTermName() {
        return termName;
    }

    public void setTermName(String termName) {
        this.termName = termName;
    }

    public String getSlug() {
        return slug;
    }

    public void setSlug(String slug) {
        this.slug = slug;
    }

    public String getTermGroup() {
        return termGroup;
    }

    public void setTermGroup(String termGroup) {
        this.termGroup = termGroup;
    }

    public int getTermOrder() {
        return termOrder;
    }

    public void setTermOrder(int termOrder) {
        this.termOrder = termOrder;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public String getFunctionDesc() {
        return functionDesc;
    }

    public void setFunctionDesc(String functionDesc) {
        this.functionDesc = functionDesc;
    }

    public List<OneClickTermMetaDto> getTermMetaList() {
        return termMetaList;
    }

    public void setTermMetaList(List<OneClickTermMetaDto> termMetaList) {
        this.termMetaList = termMetaList;
    }

    public String getWechatMenuName() {
        return wechatMenuName;
    }

    public void setWechatMenuName(String wechatMenuName) {
        this.wechatMenuName = wechatMenuName;
    }
}